package com.bwie;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;



@SpringBootApplication
//开启服务发现客户端
@EnableDiscoveryClient
//开启Feign客户端远程调用功能
@EnableFeignClients
public class OrderApplication {
    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class,args);
    }

    //定义一个Bean，相当于xml：<bean class=org.springframework.web.client.RestTemplate id=restTemplate>
//    @Bean("adbc")
    @Bean
    //为RestTemplate开启负载均衡（增强），可以拥有从Eureka中获取服务实例的能力了，还具备负载均衡算法的能力
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}








//@SpringBootApplication
//public class OrderApplication {
//    public static void main(String[] args) {
//        SpringApplication.run(OrderApplication.class,args);
//    }
//}